package com.yoj.model.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

/**
 * 题目表信息
 */
@Accessors(chain = true)
@TableName(value = "question")
@ApiModel(value = "题目信息")
@Data
public class Question implements Serializable {

    @ApiModelProperty(value = "题目 id", notes = "使用雪花算法，生成非连续自增的主键 IdType.ASSIGN_ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "标题")
    @TableField(value = "title")
    private String title;

    @ApiModelProperty(value = "内容")
    @TableField(value = "content")
    private String content;

    @ApiModelProperty(value = "题目标签列表", notes = "json 数组")
    @TableField(value = "tags")
    private String tags;

    @ApiModelProperty(value = "题目答案")
    @TableField(value = "answer")
    private String answer;

    @ApiModelProperty(value = "题目提交数")
    @TableField(value = "submitNum")
    private Integer submitNum;

    @ApiModelProperty(value = "题目通过数")
    @TableField(value = "acceptedNum")
    private Integer acceptedNum;

    @ApiModelProperty(value = "判题配置", notes = "json 对象")
    @TableField(value = "judgeConfig")
    private String judgeConfig;

    @ApiModelProperty(value = "判题用例", notes = "json 对象数组")
    @TableField(value = "judgeCase")
    private String judgeCase;

    @ApiModelProperty(value = "点赞数")
    @TableField(value = "thumbNum")
    private Integer thumbNum;

    @ApiModelProperty(value = "收藏数")
    @TableField(value = "favourNum")
    private Integer favourNum;

    @ApiModelProperty(value = "创建用户 id")
    @TableField(value = "userId")
    private Long userId;

    @ApiModelProperty(value = "创建时间")
    @TableField(value = "createTime")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "更新时间")
    @TableField(value = "updateTime")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    @TableLogic
    private Integer isDelete;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}